mudbox::PixelDescriptor Class Reference

#include <image.h>

Inheritance diagram for mudbox::PixelDescriptor:

Inheritance graph
[legend]
List of all members.

Detailed Description

Describe an image pixel; how to interpret a piece of pixel data.
Note:
The internal format preferred by MudBox is always PreMultiplied.
When you provide image data to these Image classes, it will be converted to the preferred internal representation as specified above. When image data is queried, it will almost always be returned in the preferred internal channel ordering, and will always be returned PreMultiplied.

Public Types

enum   ChannelType {
  uChar = 0, uShort = 1, sHalf = 2, sFloat = 3,
  sChar = 4, sShort = 5, uInt = 6, sInt = 7,
  sDouble = 8
}
  Describe the data type of a single channel of a pixel. More...
enum   MemoryChannelOrder {
  orderNONE = 0, orderRGBA = 1, orderABGR = 2, orderBGRA = 3,
  orderARGB = 4, orderRGB = 5, orderBGR = 6
}
  Describe channel ordering for 4 channel images -- these are the order of the channels in memory, not in registers or uInts. More...

Public Member Functions

  PixelDescriptor (char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
int  channelSize () const
  return the size of a pixel channel in bytes
int  channelBitSize () const
  return the size of a pixel channel in bits
int  pixelSize () const
  return the size of a pixel in bytes
int  pixelBitSize () const
  return the size of a pixel in bits
ChannelType  channelType () const
  Get the channel type of the image/pixel.
MemoryChannelOrder  channelOrder () const
  Get the channel ordering of the image/pixel.
bool  premultiplied () const
  returns true if the RGB values are premultiplied by the A values, false otherwise.
int  channelCount () const
  return the number of channels -- 1, 3, or 4
bool  operator== (const PixelDescriptor &pd) const
  returns true if the pixel descriptors are equal

Protected Attributes

char  m_cCount
  number of channels in the image -- 1, 3, or 4
ChannelType  m_channelType
  Channel type.
MemoryChannelOrder  m_channelOrder
  channel ordering
bool  m_PreMultiplied
  true if RGB is premultiplied by A

Member Enumeration Documentation

enum mudbox::PixelDescriptor::ChannelType
 

Describe the data type of a single channel of a pixel.

Enumeration values:
uChar  unsigned 8 bit char
uShort  unsigned 16 bit short
sHalf  S10E5 half precision floating point.
sFloat  IEEE754 single precision.
sChar  signed 8 bit char (not currently supported)
sShort  signed 16 bit short (not currently supported)
uInt  unsigned 32 bit int (not currently supported)
sInt  signed 32 bit int (not currently supported)
sDouble  IEEE754 double precision (not currently supported).
01118                  {
01119         uChar   = 0,  
01120         uShort  = 1,  
01121         sHalf   = 2,  
01122         sFloat  = 3,  
01124         sChar   = 4,  
01125         sShort  = 5,  
01126         uInt    = 6,  
01127         sInt    = 7,  
01128         sDouble = 8   
01129     } ChannelType;
enum mudbox::PixelDescriptor::MemoryChannelOrder
 

Describe channel ordering for 4 channel images -- these are the order of the channels in memory, not in registers or uInts.

Enumeration values:
orderNONE  This is invalid for 4 channel images -- used for 1 channel.
orderRGBA  standard RGBA
orderABGR  reverse of RGBA
orderBGRA  Optimal ordering on windows & Mac.
orderARGB  Reverse of BGRA.
orderRGB  RGB -- for 3 channel images.
orderBGR  Reverse of RGB for 3 channel images.
01133                  {
01134         orderNONE = 0, 
01135         orderRGBA = 1, 
01136         orderABGR = 2, 
01137         orderBGRA = 3, 
01138         orderARGB = 4, 
01139         orderRGB  = 5, 
01140         orderBGR  = 6  
01141     } MemoryChannelOrder;

Constructor & Destructor Documentation

mudbox::PixelDescriptor::PixelDescriptor char  cCount,
ChannelType  channelType,
MemoryChannelOrder  channelOrder,
bool  PreMultiplied
[inline]
 
01156         : m_cCount       (cCount)
01157         , m_channelType  (channelType)
01158         , m_channelOrder (channelOrder)
01159         , m_PreMultiplied(PreMultiplied) {}

Member Function Documentation

int mudbox::PixelDescriptor::channelSize  )  const [inline]
 

return the size of a pixel channel in bytes

01162                             {
01163         const unsigned char s_channelByteCount[] = {1, 2, 2, 4, 1, 2, 4, 4, 8};
01164         return s_channelByteCount[m_channelType];
01165     }
int mudbox::PixelDescriptor::channelBitSize  )  const [inline]
 

return the size of a pixel channel in bits

01168                                {
01169         return channelSize() * 8;
01170     }
int mudbox::PixelDescriptor::pixelSize  )  const [inline]
 

return the size of a pixel in bytes

01173                           {
01174         return channelSize() * m_cCount;
01175     }
int mudbox::PixelDescriptor::pixelBitSize  )  const [inline]
 

return the size of a pixel in bits

01178                              {
01179         return pixelSize() * 8;
01180     }
ChannelType mudbox::PixelDescriptor::channelType  )  const [inline]
 

Get the channel type of the image/pixel.

01183 { return m_channelType; }
MemoryChannelOrder mudbox::PixelDescriptor::channelOrder  )  const [inline]
 

Get the channel ordering of the image/pixel.

01186 { return m_channelOrder; }
bool mudbox::PixelDescriptor::premultiplied  )  const [inline]
 

returns true if the RGB values are premultiplied by the A values, false otherwise.

Default is true...

01190 { return m_PreMultiplied; }
int mudbox::PixelDescriptor::channelCount  )  const [inline]
 

return the number of channels -- 1, 3, or 4

01193 { return m_cCount; }
bool mudbox::PixelDescriptor::operator== const PixelDescriptor pd  )  const [inline]
 

returns true if the pixel descriptors are equal

01197     { return (m_cCount         == pd.m_cCount        &&
01198               m_channelType    == pd.m_channelType   &&
01199               m_channelOrder   == pd.m_channelOrder  &&
01200               m_PreMultiplied  == pd.m_PreMultiplied);
01201     }

Member Data Documentation

char mudbox::PixelDescriptor::m_cCount [protected]
 

number of channels in the image -- 1, 3, or 4

ChannelType mudbox::PixelDescriptor::m_channelType [protected]
 

Channel type.

MemoryChannelOrder mudbox::PixelDescriptor::m_channelOrder [protected]
 

channel ordering

bool mudbox::PixelDescriptor::m_PreMultiplied [protected]
 

true if RGB is premultiplied by A


mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor
mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor mudbox::PixelDescriptor